//
//  CHChatViewController.h
//  ChildHoodStemp
//
//  Created by 日东 罗 on 13-10-5.
//
//

#import <UIKit/UIKit.h>
#import "ChildHoodMemory.h"
#import "ChatToolBar.h"
#import "EmotionView.h"
//#import "ChatToolMoreView.h"
#import "TouchTable.h"
#import "CContactModel.h"
#import "CHBubbleMessageCell.h"
#import "CGroupModel.h"

#define INPUT_HEIGHT 44.0f


@protocol CHChatViewDelegate <NSObject>
@required
- (CHBubbleMessageType)messageTypeForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CHBubbleStyle)messageStyleForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CHMessagesViewTimestampPolicy)timestampPolicy;
- (CHAvatarStyle)avatarStyle;

@optional
- (void)sendImageMessage:(UIImage *)image index:(NSInteger)index;
- (void)sendTextMessage:(NSString *)message;
- (void)contentTextViewTextDidChangeWithText:(NSString *)text;
- (void)sendMapImageMessage:(UIImage*)mapImage withLat:(double)lat andLon:(double)lon;
- (BOOL)ismapForRowAtIndexPath:(NSIndexPath *)indexPath;
@optional
- (BOOL)hasTimestampForRowAtIndexPath:(NSIndexPath *)indexPath;
@end

@protocol CHChatViewDataSource <NSObject>
@required
- (int64_t)voiceMessageDBIDForRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)voiceIsPlayForRowAtIndexPath:(NSIndexPath *)indexPath;
- (CGFloat)voiceTimeForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)voiceURIForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSArray *)pictureURIArrayForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)senderNameForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)senderTitleForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)textForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSDate *)timestampForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)avatarImageURIForReceivedMessageRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)avatarImageURIForSendedMessageRowAtIndexPath:(NSIndexPath *)indexPath;
- (int32_t)messageStatusForRowAtIndexPath:(NSIndexPath *)indexPath;
- (uint32_t)memoryIDForRowAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)isNoticeForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)fileNameForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)fileIdForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSString *)chatTypeForRowAtIndexPath:(NSIndexPath *)indexPath;

@end

@interface CHChatViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UITextViewDelegate,CHBubbleMessageCellDelegate,UIActionSheetDelegate>
{
    __weak id<CHChatViewDelegate> _delegate;
    __weak id<CHChatViewDataSource> _dataSource;
}
@property (weak, nonatomic) id<CHChatViewDelegate> delegate;
@property (weak, nonatomic) id<CHChatViewDataSource> dataSource;
@property (strong, nonatomic) TouchTable *tableView;
@property (retain, nonatomic) ChatToolBar *chatToolBar;
@property (retain, nonatomic) EmotionView *emoView;
@property (strong, nonatomic) NSMutableArray *messages;
@property (nonatomic, strong) CContactModel *member;
@property (nonatomic, strong) CGroupModel *group;
@property (nonatomic, assign) BOOL isShowSection;
@property (nonatomic,strong) NSURL *videoUrl;
//@property (nonatomic, assign) BOOL isAPP_Pc;
//@property (nonatomic ,retain) ChatToolMoreView* moreView;

@property (assign, nonatomic) CGFloat previousTextViewContentHeight;

#pragma mark - Messages view controller
- (BOOL)shouldHaveTimestampForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)setBackgroundColor:(UIColor *)color;
- (void)scrollToBottomAnimated:(BOOL)animated;
-(void)resetChatTool;
- (void)sendFileWithArray:(NSArray *)array;
-(BOOL)isNeedScrollToBottom;
- (void)click;
//- (void)jumpToDetailInfoView:(id)sender;

@end
